<%@ page language="java" pageEncoding="UTF-8"%>
<%@include file="/global/global-head.jsp" %>
<!DOCTYPE html>
<html lang="zh">
<head>
    <title>吉车惠后台管理系统</title>
    <%@include file="/global/global-other.jsp" %>

    <script type="text/javascript">
        var $bn_advertisement_list = new Object();
        var $bn_advertisement_list_Datagrid;
        var $bn_advertisement_list_toolbar = [{
                text:'<i class="fa fa-search" aria-hidden="true"></i>刷新',
                handler:function(){
                    $bn_advertisement_list.reload();
                }
            }
        ];
        $(function(){
            //gird 初始化
            $bn_advertisement_list_Datagrid = $('#bn_advertisement_list_Datagrid').datagrid({
                filterBtnIconCls:'icon-filter',
                queryParams: {
                    "filter_EQ_a.delete_status" : 0
                },
                pageSize : 20,
                remoteFilter:true
            });

            $bn_advertisement_list_Datagrid.datagrid('enableFilter', [
                {field:'email',type:'label'},
                {field:'pic',type:'label'},
                {field:'url',type:'label'},
                {field:'createAt',type:'label'},
                {field:'t',type:'label'}
            ]);

            chooseAd = function(){
                var row = $bn_advertisement_list_Datagrid.datagrid('getSelected');
                if(row==null){
                    parent.$.messager.alert("提示",errMsg("请选择一行数据！"),"error");
                }else{
                    var json = {
                        "advertisementId": row.advertisementId,
                        "advertiserId": row.advertiserId,
                        "adName": row.adName,
                        "adShortName": row.adShortName,
                        "pic": row.pic,
                        "url": row.url,
                        "content": row.content
                    };
                    return json;
                }
            }
        });

        //刷新

        $bn_advertisement_list.reload = function(){
            $bn_advertisement_list_Datagrid.datagrid('reload');
        };

    </script>
</head>
<body>
<div class="easyui-layout" data-options="fit:true">
    <div data-options="region:'center',border:false">
        <table id="bn_advertisement_list_Datagrid"  style="width:100%;height:100%"
               data-options="border:false,rownumbers:true,autoRowHeight:false,singleSelect:true,pagination:true,sortName:'createAt',sortOrder:'desc',toolbar:$bn_advertisement_list_toolbar,rowStyler: function(index,row){return {style:'height:30px'};},url:'${ctx}/bn/advertisement/issue/up/insert?_m=adquerying',method:'post'">
            <thead>
            <tr>
                <th data-options="field:'advertiserNo',width:120,align:'center'">广告主编号</th>
                <th data-options="field:'advertiserName',width:120,align:'center'">广告主名称</th>
                <th data-options="field:'adName',width:200,align:'center'">广告全称</th>
                <th data-options="field:'adShortName',width:150,align:'center'">广告简称</th>
                <th data-options="field:'pic',width:100,align:'center',formatter:
                    function(value,row,index){
                        if(row.pic==''||row.pic==undefined){
                            return '无';
                        }
                        return '<a href=\''+row.pic+'\' target=\'_blank\'>图片</a>'
                    }
                ">图片</th>
                <th data-options="field:'url',width:100,align:'center',formatter:
                    function(value,row,index){
                        if(row.url==''||row.url==undefined){
                            return '无';
                        }
                        return '<a href=\''+row.url+'\' target=\'_blank\'>地址</a>'
                    }
                ">访问地址</th>
                <th data-options="field:'createAt',width:150,align:'center'">添加时间</th>
                <th data-options="field:'t',width:20,align:'center'"></th>
            </tr>
            </thead>
        </table>
    </div>
</div>
</body>
</html>